package com.sumainfor.pc.epc.controller.housekeeper;

import com.sumainfor.common.util.JsonResult;
import com.sumainfor.common.utlis.Pager;
import com.sumainfor.pc.epc.feign.Zfeign.ZpcMktFeign;
import com.sumainfor.pc.epc.service.HoHousingAlterService;
import com.sumainfor.pc.epc.service.RepairService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/housekeeper/HoHousingAlter")
public class HoHousingAlterController implements Serializable{

    @Autowired
    private HoHousingAlterService hoHousingAlterService;

    /**
     *运营部服务管家根据房源配置主表编号查询房源配置变更
     */
    @GetMapping("/getHoHousingAlterList")
    public JsonResult getHoHousingAlterList(@RequestParam Map<String,Object>params) {
        JsonResult result=new JsonResult();
        return hoHousingAlterService.getHoHousingAlterList(params);
    }
    /**
     * 运营部服务管家发起配置变更
     */
    @PostMapping("/addHoHousingAlter")
    public JsonResult addHoHousingAlter(@RequestBody Map<String,Object>params) {
        JsonResult result=new JsonResult();
        return hoHousingAlterService.addHoHousingAlter(params);
    }
    /**
     *服务管家查询房间的物品清单
     */
    @GetMapping("/getHoHousingAlterRentList")
    public JsonResult getHoHousingAlterRentList(@RequestParam Map<String,Object>params) {
        JsonResult result=new JsonResult();
        List<Map<String,Object>> list=hoHousingAlterService.getHoHousingAlterRentList(params);
        if(list!=null){
            result.put(list);
        }else{
            result.put("服务器繁忙");
        }
        return  result;
    }
    /**
     *服务管家查询整租房间的公共区域的物品清单
     */
    @GetMapping("/getHoHousingAlterRentComList")
    public JsonResult getHoHousingAlterRentComList(@RequestParam Map<String,Object>params) {
        JsonResult result=new JsonResult();
        params.put("HouConType",1);//房源类型   1公共区域   2房源
        List<Map<String,Object>> list=hoHousingAlterService.getHoHousingAlterRentComList(params);
        if(list!=null){
            result.put(list);
        }else{
            result.put("服务器繁忙");
        }
        return  result;
    }
    /**
     *服务管家查询整租房间的物品清单
     */
    @GetMapping("/getHoHousingAlterRenthuzList")
    public JsonResult getHoHousingAlterRenthuzList(@RequestParam Map<String,Object>params) {
        JsonResult result=new JsonResult();
        params.put("HouConType",2);//房源类型   1公共区域   2房源
        List<Map<String,Object>> list=hoHousingAlterService.getHoHousingAlterRentComList(params);
        if(list!=null){
            result.put(list);
        }else{
            result.put("服务器繁忙");
        }
        return  result;
    }
    /**
     *查询房源的配置变更列表（服务管家配置变更记录、服务中心经理配置变更记录）
     */
    @GetMapping("/getHoAlterList")
    public JsonResult getHoAlterList(@RequestParam Map<String,Object>params) {
        return  hoHousingAlterService.getHoAlterList(params);
    }
    /**
     *查询房源的配置变更列表（服务管家配置变更记录、服务中心经理配置变更记录）
     */
    @GetMapping("/getHoAlterListByAltId")
    public JsonResult getHoAlterListByAltId(@RequestParam Map<String,Object>params) {
        return  hoHousingAlterService.getHoAlterListByAltId(params);
    }
    /**
     *服务中心经理审核配置变更
     */
    @PostMapping("/updateHoHouAlter")
    public JsonResult updateHoHouAlter(@RequestBody Map<String,Object>params) {
        return  hoHousingAlterService.updateHoHouAlter(params);
    }
    /**
     *查询房源是否有正在审核中的配置变更(服务管家配置变更记录、服务中心经理配置变更记录）
     */
    @GetMapping("/getHoAlterStateByAltId")
    public JsonResult getHoAlterStateByAltId(@RequestParam Map<String,Object>params) {
        return  hoHousingAlterService.getHoAlterStateByAltId(params);
    }

    /**
     * 根据配置变更主表便阿红查询房间配置
     * @param params
     * @return
     */
    @PostMapping("/getHouConIdPlan")
    public JsonResult getHouConIdPlan(@RequestBody Map<String,Object> params){
        return hoHousingAlterService.getHouConIdPlan(params);
    }

    /**
     * 提交变更
     */
    @PostMapping("/addHouConPlan")
    public JsonResult addHouConPlan(@RequestBody Map<String,Object> params){
        return hoHousingAlterService.addHouConPlan(params);
    }

}
